import gradio as gr

# 定义变量
URL = "http://127.0.0.1:8188/prompt"
INPUT_DIR = "D:\PycharmProjects\ComfyUI\ComfyUI\input"
OUTPUT_DIR = "D:\PycharmProjects\ComfyUI\ComfyUI\output"


# v2
def index_box():
    with gr.Blocks(analytics_enabled=False) as index:
        gr.Markdown("<div align='center'>"
                    " <h1>ComfyUI_Easy_Link</h1>"
                    "<h3>作者：Xik</h3>"
                    "</div>")
        btn=gr.Button("切换")
        btn.click(
            fn=mode,
            inputs=["text"],
            outputs=index
        )


    return index

def mode(mode):
    if mode=="1":
        with gr.Blocks(analytics_enabled=False) as mode1:
            gr.Text("1")
        return mode1
    elif mode=="2":
        with gr.Blocks(analytics_enabled=False) as mode2:
            gr.Text("2")
        return mode2




if __name__ == "__main__":
    index = index_box()
    index.queue()
    index.launch()
